package org.jash.launcher.model

import org.jash.common.mvi.BaseViewModel
import org.jash.common.R
import org.jash.launcher.entity.GatewayEntity

class GatewayViewModel:BaseViewModel<GatewayIntent, GatewayState>() {
    private val iconsArray = arrayOf(
        R.drawable.icon32,R.drawable.icon32,R.drawable.icon140,
        R.drawable.icon829,R.drawable.icon359,
        R.drawable.icon1353,R.drawable.icon3)
    private val titleArray = arrayOf("在线应用","本地应用","考勤打卡","智能审批","工作日志",
        "任务","文件")
    private val pathArray = arrayOf("/apps/net",
        "/apps/local",
        "/attendance/sign",
        "智能审批","/report/report",
        "任务","/document/doc")
    private val iconsIMArray = arrayOf(R.drawable.icon1887,R.drawable.icon1622,
        R.drawable.icon1904)

    private val titleIMArray = arrayOf("联系人","讨论组","组织架构")
    private val pathIMArray = arrayOf("联系人","讨论组","组织架构")
    fun createGateway(create: GatewayIntent.CreateGateway) {
        val data:MutableList<GatewayEntity> = mutableListOf()
        data.add(GatewayEntity("应用", R.drawable.icon1382, "", 100))
        data.addAll(iconsArray.zip(titleArray).zip(pathArray) {(icon, title),path ->
            GatewayEntity(title, icon, path, 200)
        })
        data.add(GatewayEntity("通信", R.drawable.icon1488, "", 100))
        data.addAll(iconsIMArray.zip(titleIMArray).zip(pathIMArray) {(icon, title),path ->
            GatewayEntity(title, icon, path, 200)
        })
        data.add(GatewayEntity("公众号", R.drawable.icon352, "", 100))
        data.add(GatewayEntity("", R.drawable.icon224, "", 300))
        data.add(GatewayEntity("知识中心", R.drawable.icon1131, "", 100))
        data.add(GatewayEntity("", R.drawable.icon224, "", 300))
        state.value = GatewayState.Response(data)
    }
}